Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate device factory into a creator layer #970

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

badrishc
Copy link
Contributor

@badrishc badrishc commented Jan 28, 2025

Separate device factory into a creator layer so that expensive connection costs can be incurred once, for device types such as cloud storage. Workflow now is:

(1) Instantiate a factory creator
(2) Ask creator for a factory, given a base path
(2) Ask factory for devices instances

Fixes #739.

…ive connection costs can be incurred once, for device types such as cloud storage. Process now is:

(1) Instantiate a factory creator
(2) Ask creator for a factory, given a base path
(2) Ask factory for devices
@badrishc
Copy link
Contributor Author

badrishc commented Jan 28, 2025

Note: It seems that the AzureStreamProvider currently creates its own "factory creator" using the provided connection string (even before GarnetServerOptions are created), so it is possible we instantiate the connection twice in case user were importing/exporting the config file from Azure. Ideally we would pass in a shared azure storage factory creator to the stream provider and use the same for GarnetServerOptions. But this seems to be a rare case, so did not optimize for it.

Copy link
Contributor

@TalZaccai TalZaccai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -277,9 +277,9 @@ public class GarnetServerOptions : ServerOptions
public int NetworkConnectionLimit = -1;

/// <summary>
/// Creator of device factories
/// Func to help create device factories
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: looks like the comment wasn't updated properly?

readonly bool readOnly;
readonly ILogger logger;

public LocalStorageNamedDeviceFactoryCreator(bool preallocateFile = false, bool deleteOnClose = false, bool disableFileBuffering = true, int? throttleLimit = null, bool useNativeDeviceLinux = false, bool readOnly = false, ILogger logger = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have an XML comment that describes each parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initialize azure blob storage client once during startup
2 participants